import time

def bububle(h):
    swped = True
    while swped == True:
        swped = False
        for i in range(len(h) - 1):
            if int(h[i]) > int(h[i+1]):
                h[i],h[i+1] = h[i+1],h[i]
                swped = True
    return h

q1 = open('m1_sorted.txt')
q2 = open('m2_reverse.txt')
q3 = open('m3_shuffle.txt')
array1 = q1.readlines()
array2 = q2.readlines()
array3 = q3.readlines()

t_start = time.time()
x1 = bububle(array1)
t_finish = time.time()
print('Время m1', round(t_finish - t_start)*1000, 'mc')

t_start = time.time()
x2 = bububle(array2)
t_finish = time.time()
print('Время m2', round(t_finish - t_start)*1000, 'mc')

t_start = time.time()
x3 = bububle(array3)
t_finish = time.time()
print('Время m3', round(t_finish - t_start)*1000, 'mc')